package com.homegoods.area;

import android.util.Log;

import com.alibaba.fastjson.JSON;
import com.homegoods.area.model.AreaModel;
import com.homegoods.classify.model.Constant;
import com.network.retrofit_rx.Api.ActionSubscriber;
import com.network.retrofit_rx.Api.CommandImpl;
import com.network.retrofit_rx.Api.HttpManager;


import java.util.List;

import io.reactivex.functions.Consumer;

public class AreaApiUtils {
    /**
     * 获取添加地址地区列表
     *
     * @param error
     */
    public static void getAreaList(Consumer<List<AreaModel>> consumer, Consumer<Throwable> error) {
        CommandImpl command = new CommandImpl.Builder()
                .setUrl(/*Constant.SERVER_URL*/"https://www.myzpzy.com/" + "JosnData/GlbAreaLib.json")
                .setObject(false) /*此处返回数据如果是数组为false，如果为字符为true*/
                .setClass(AreaModel.class)
                .create();

        HttpManager.getInstance().get(command, new ActionSubscriber<>(consumer, error, null));
    }

}
